package com.darwin.darwinUnit
{
	/**
	 * 测试的结果类
	 * @author lipi
	 */
	public class TestResult
	{
		public function TestResult()
		{
		}
		
		public static const NOT_METHOD:String = "not method";
		public static const ERROR_RESULT:String = "error result";
		public static const OK:String = "ok";
		public static const NOT_CALLBACK:String = "not callback";
		public static const ERROR_CALLBACK:String = "errorCallback";
		
		public static const CALLBACK:String = "未赋值";
		
		public var succeed:Boolean = false;
		public var type:String = "";
		
//		public var qualifiedClassName:String;
		
		public var className:String;
		
		public var methodName:String;
		
		/**
		 * 错误描述
		 */
		public var desc:String = "";
		
		/**
		 * 参数
		 */
		public var arg:Array;
		
		/**
		 * 返回的结果
		 */
		public var result:Object;
		
		
		
		private function arrayToString(arr:Array):String
		{
			if(arr == null) return "(NULL)";
			var $str:String = "";
			for(var i:int = 0;i<arr.length;i++)
			{
				$str+= arr[i].toString();
				if(i<arr.length - 1)
				{
					$str += "，";
				}
			}
			$str += "";
			return $str;
		}
		
		public function toString():String
		{
			var r:String = "";
			r+= "SUCCEED:"+succeed + ",";
			r+= "TYPE:" + type + ";";
			r+= "CLASS NAME:" + className + ",";
			r+= "METHOD NAME:" + methodName + ",";
			r+= "DESC:" + desc + ",";
			r+= "ARG:" + arrayToString(arg) + ",";
			if(result)
			{
				r+= "RESULT:" + result.toString() + ",";
			}else{
				r+= "RESULT:null";
			}
			return r;
		}
	}
}